{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Smile in Clojupyter\n",
    "You can fetch external Clojure dependencies using the clojupyter.misc.helper namespace."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "(require '[clojupyter.misc.helper :as helper])\n",
    "(helper/add-dependencies '[org.clojars.haifengl/smile \"4.0.0\"])\n",
    "(in-ns 'smile.ai)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Load the Iris data and train a random forest model."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "(import '[smile.data.formula Formula])\n",
    "\n",
    "(let [iris (read-arff \"../data/weka/iris.arff\")\n",
    "      model (random-forest (Formula/lhs \"class\") iris)]\n",
    "  (.error model))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Clojure (clojupyter=0.3.2=1)",
   "language": "clojure",
   "name": "conda-clojupyter"
  },
  "language_info": {
   "file_extension": ".clj",
   "mimetype": "text/x-clojure",
   "name": "clojure",
   "version": "1.10.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
